package com.mingqijia.gassafety.statistics.constant;

import lombok.Getter;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;

import java.util.*;

@Getter
@RequiredArgsConstructor
public enum ScreenStatisticsAlarmTypeEnum {

    //1-SOS、2-烟雾报警、3-烟雾防拆报警、4-漏水报警、5-水浸防拆报警、6-门锁防拆报警、7-门锁密码连续输错5次
    ALARM_TYPE_1(1, "SOS"),
    ALARM_TYPE_2(2, "烟雾报警"),
    ALARM_TYPE_3(3, "烟雾防拆报警"),
    ALARM_TYPE_4(4, "漏水报警"),
    ALARM_TYPE_5(5, "水浸防拆报警"),
    ALARM_TYPE_6(6, "门锁防拆报警"),
    ALARM_TYPE_7(7, "门锁密码连续输错5次");

    private final int code;
    private final String name;

    public static String getStateName(int code) {
        if (code == 0) {
            return null;
        }
        for (ScreenStatisticsAlarmTypeEnum areaEnum : ScreenStatisticsAlarmTypeEnum.values()) {
            if (areaEnum.code == code) {
                return areaEnum.name;
            }
        }
        return null;
    }

    public static Map<Integer, String> getMap() {
        Map<Integer, String> areaEnumMap = new HashMap<>();
        for (ScreenStatisticsAlarmTypeEnum areaEnum : ScreenStatisticsAlarmTypeEnum.values()) {
            areaEnumMap.put(areaEnum.code, areaEnum.name);
        }
        return areaEnumMap;
    }
}